package dfbz.com.controller.Dept;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import dfbz.com.controller.BaseServlet;
import dfbz.com.model.Dept;
import dfbz.com.service.DeptService;
import dfbz.com.service.impl.DeptServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.*;

@WebServlet("/dept/*")
public class DeptServlet extends BaseServlet {

    DeptService deptService=new DeptServiceImpl();

    public void showDept(HttpServletRequest request, HttpServletResponse response){
        List<Map<String, Object>> depts = deptService.showDept();
        request.getSession().setAttribute("depts",depts);

        try {
            request.getRequestDispatcher("/view/showDept").forward(request,response);
        } catch (ServletException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }






}